let base = "";

export const postKeyValueRequest=(url,params)=>{
    return axios({
       method:'post',
       url:`${base}${url}`,
       data:params,
       transformRequest:[function (data) {
            let ret = '';
            for (let i in data){
                ret+=encodeURIComponent(i)+'='+encodeURIComponent(data[i])+'&'
            }
            return ret;
       }],
       headers:{
           'Content-Type':'application/x-www-form-urlencoded'
       }
    });
};

export const postRequest=(url,params)=>{
    return axios({
        method:'post',
        url:`${base}${url}`,
        data:params
    });
};

export const putRequest=(url,params)=>{
    return axios({
        method:'put',
        url:`${base}${url}`,
        data:params
    });
};
export const getRequest=(url,params)=>{
    return axios({
        method:'get',
        url:`${base}${url}`,
        data:params
    });
};
export const deleteRequest=(url,params)=>{
    return axios({
        method:'delete',
        url:`${base}${url}`,
        data:params
    });
};